/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Engine2D.renderer;

import Engine2D.geometry.Shape;
import org.lwjgl.opengl.GL11;

/**
 *
 * @author Garys
 */
public class ShapeRenderer {

    private static GLRenderer renderer = Renderer.get();
    private static LineStripRendererInterface lineRenderer = new LineStripRenderer();

    /**
     * 
     * @param shape
     */
    public static void draw(Shape shape) {

        float points[] = shape.getPoints();

        if (points.length > 0) {


            lineRenderer.start();
            for (int i = 0; i < points.length; i += 2) {
                lineRenderer.vertex(points[i], points[i + 1]);


            }

            if (shape.closed()) {

                lineRenderer.vertex(points[0], points[1]);
            }


            lineRenderer.end();
        }

    }
}
